﻿/* ==============================================================================
 * 功能描述：SkillConfig  
 * 
 * 创 建 者：郑镇泉
 * 
 * 创建日期：2016/4/15 22:35:13
 * ==============================================================================*/
using UnityEngine;
using System.Collections;

public class SkillConfigProvider : BaseProvider<SkillConfigProvider>
{
    private SkillConfig skillConfig;

    public SkillConfig SkillConfig
    {
        get
        {
            if (skillConfig == null)
            {
                skillConfig = LoadConfig<SkillConfig>("/xml/skillConfig.xml");
            }
            return skillConfig;
        }
    }

    public SkillConfigSkill[] GetAll()
    {
        return SkillConfig.Items;
    }

    public SkillConfigSkill GetSkillById(int id)
    {
        SkillConfigSkill goods = System.Array.Find<SkillConfigSkill>(SkillConfig.Items, (SkillConfigSkill obj) =>
        {
            return int.Parse(obj.id) == id;
        });
        if (goods == null) Debug.Log("配置表中找不到该物品，id：" + id);
        return goods;
    }
}